﻿using System;
using UnityEngine;

public class Action2015 : GameAction {
    private ActionResult actionResult;

    public Action2015 ( )
        : base(2015) {
    }

    protected override void SendParameter (NetWriter writer, ActionParam actionParam) {
    }

    protected override void DecodePackage (NetReader reader) {
        actionResult = new ActionResult( );
        actionResult["MultipleNum"] = reader.getInt( );
        actionResult["AnteNum"] = reader.getInt( );
        actionResult["IsAI"] = reader.getByte( );
        actionResult["IsShow"] = reader.getByte( );
        actionResult["LandlordId"] = reader.getInt( );

        int subRecordCount = reader.getInt( );
        var subTable = new ActionResult[subRecordCount];
        for (int i = 0; i < subRecordCount; i++) {
            var subRecord = new ActionResult( );
            reader.recordBegin( );
            subRecord["UserId"] = reader.getInt( );
            subRecord["NickName"] = reader.readString( );
            subRecord["HeadIcon"] = reader.readString( );
            subRecord["PosId"] = reader.getInt( );

            int subRecordCount_1 = reader.getInt( );
            var subTable_1 = new ActionResult[subRecordCount_1];
            int r = 0;
            for (r = 0; r < subRecordCount_1; r++) {
                var subRecord_1 = new ActionResult( );
                reader.recordBegin( );
                subRecord_1["CardId"] = reader.getInt( );
                reader.recordEnd( );
                subTable_1[r] = subRecord_1;
            }
            subTable = subTable_1;
            reader.recordEnd( );
            subTable[r] = subRecord;
        }
        actionResult["Children_1"] = subTable;

        subRecordCount = reader.getInt( );
        subTable = new ActionResult[subRecordCount];
        for (int i = 0; i < subRecordCount; i++) {
            var subRecord = new ActionResult( );
            reader.recordBegin( );
            subRecord["CardId"] = reader.getInt( );
            reader.recordEnd( );
            subTable[i] = subRecord;
        }
        actionResult["Children_2"] = subTable;
        actionResult["CodeTime"] = reader.getInt( );
        actionResult["OutCardUserId"] = reader.getInt( );
        actionResult["IsReNew"] = reader.getByte( );
        actionResult["GameCoin"] = reader.getInt( );

        subRecordCount = reader.getInt( );
        subTable = new ActionResult[subRecordCount];
        for (int i = 0; i < subRecordCount; i++) {
            var subRecord = new ActionResult( );
            reader.recordBegin( );
            subRecord["CardId"] = reader.getInt( );
            reader.recordEnd( );
            subTable[i] = subRecord;
        }
        actionResult["Children_3"] = subTable;
        actionResult["DeckType"] = reader.getWORD( );
        actionResult["CardSize"] = reader.getInt( );
        actionResult["PreUserId"] = reader.getInt( );

    }

    public override ActionResult GetResponseData ( ) {
        return actionResult;
    }
}
